<template>
  <div class="home">
    <el-menu
      class="w240"
      default-active="2"
      @open="handleOpen"
      @close="handleClose"
      background-color="#545c64"
      text-color="#fff"
      :router="true"
      active-text-color="#ffd04b"
    >
      <el-menu-item  v-for="(item, index) in routes[0].children" :key="index" :index="item.path">
        <span slot="title">
          {{ item.meta.title }}
        </span>
      </el-menu-item>

    </el-menu>

    <router-view/>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: "Home",
  computed: {
    ...mapState(["routes"])
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>
